package com.parsechina.hpush.broker.parser;

import io.netty.handler.codec.mqtt.MqttUnsubscribeMessage;

import java.util.List;

/**
 * @author linfeng
 * @since 2016/11/22
 */
public class UnsubscribeMessage extends PushMessage {
    private static final long serialVersionUID = -7022865833216668929L;

    private MqttUnsubscribeMessage unsubscribeMessage;
    private List<String> topicFilters;
    private int messageId;

    public UnsubscribeMessage(MqttUnsubscribeMessage msg) {
        super(msg);
        this.unsubscribeMessage = msg;
        this.topicFilters = unsubscribeMessage.payload().topics();
        this.messageId = unsubscribeMessage.variableHeader().messageId();
    }

    public List<String> topicFilters() {
        return topicFilters;
    }

    public int getMessageId() {
        return messageId;
    }
}
